/** layuiAdmin.std-v1.2.1 LPPL License By http://www.layui.com/admin/ */
;layui.define(["table", "form"], function(t) {
    var e = layui.$,
    	$ = layui.jquery,
        i = layui.table,
        n = layui.form;
    i.render({
        elem: "#LAY-app-content-list",
        url: "list_data.xhtml",
        cols: [[{
            type: "checkbox",
            fixed: "left"
        }, {
            field: "uuid",
            hide:true,
            title: "UIID"
        }, {
        	field: "cabinetbox_name",
        	title: "隔间板名称",
        	minWidth: 100
        }, {
            field: "alias_name",
            title: "别名",
            minWidth: 100
        }, {
            field: "address_485",
            title: "485地址"
        }, {
        	title: "关联网关",
        	templet:"<div>{{d.deviceGateway.gateway_name}}</div>"
        }, {
            field: "dz_value",
            title: "单重值",
            templet: "#dz_value_view"
        }, {
        	field: "bd_value",
        	title: "标定值",
        	templet: "#bd_value_view"
        }, {
        	field: "dz_value_err",
        	title: "单重值误差",
        }, {
        	field: "run_state",
        	title: "运行状态",
        	templet: "#run_state_view"
        }, {
            title: "操作",
            minWidth: 100,
            align: "center",
            toolbar: "#table-content-list"
        }]],
        page: !0,
        limit: 10,
        limits: [10, 15, 20, 25, 30],
        text: {
        	none:"暂无数据！"
        },
        xx:{}
    }),
    i.on("tool(LAY-app-content-list)", function(t) {
        var e = t.data;
        var layEvent = t.event;
        switch(layEvent){
        case "del":
        	layer.confirm("确定删除此隔间板信息？", function(e) {
            	$.post("del.xhtml",{"uuid":t.data.uuid},function(data){
            		i.reload('LAY-app-content-list');
                });
                layer.close(e);
        	})
        	break;
        case "edit":
        	layer.open({
	            type: 2,
	            title: "编辑",
	            content: "edit.xhtml?uuid="+e.uuid,
	            maxmin: !0,
	            area: ["550px", "550px"],
	            btn: ["确定", "取消"],
	            yes: function(e, i) {
	                var l = window["layui-layer-iframe" + e],
	                    a = i.find("iframe").contents().find("#layuiadmin-app-form-submit");
	                a.trigger("click");
	            }
	        })
	    	break;
        case "cailorigin":
        	$.post("cabinetBoxCailOrigin.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("去皮重命令已发送");
            });
        	break;
        case "cailweight":
        	$.post("cabinetBoxCailWeight.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("标定重量命令已发送");
            });
        	break;
        case "getcnt":
        	$.post("cabinetBoxGetCnt.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("获取数量命令已发送");
            });
        	break;
        case "getweight":
        	console.log(t);
        	$.post("cabinetBoxGetWeight.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("获取重量命令已发送");
            });
        	break;
        case "sigobjweight":
        	$.post("cabinetBoxSigObjWeight.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("单物体重量命令已发送");
            });
        	break;
        case "sigobjweighterr":
        	$.post("cabinetBoxSigObjWeightErr.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("重量误差命令已发送");
            });
        	break;
        case "getboxname":
        	$.post("cabinetBoxSearch.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("获取别名命令已发送");
            });
        	break;
        case "setboxname":
        	$.post("cabinetBoxSearch.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("设置别名命令已发送");
        	});
        	break;
        case "search":
        	$.post("cabinetBoxSearch.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("搜索命令已发送");
            });
        	break;
        case "set_dz_value_err":
        	$.post("cabinetBoxSigObjWeightErr.xhtml",{"uuid":t.data.uuid},function(data){
        		layer.msg("关门命令已发送");
            });
        	break;
        default:
        	break;
        }
    }),
    t("device/cabinetbox/list", {})
});
